﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Expo.Training.BRule;
using System.Data;
using Expo.Training.DataAccess.Site;
using Expo.Training.Entity;

public partial class XB_MasterPage_MasterPage : MasterPageBase
{
    string source = Base.Source;
    protected void Page_Load(object sender, EventArgs e)
    {
        initLink();
        BindOnlineNum();
    }

    protected void BindOnlineNum()
    {

        Guid customerID = new Guid(System.Configuration.ConfigurationManager.AppSettings["DefaultCustomerID"]);
        Expo.Training.BRule.Site.Online objO = new Expo.Training.BRule.Site.Online();
        /*
        DataTable dt = objO.GetOnlineCount(DateTime.Today, DateTime.Today.AddDays(1).Subtract(new TimeSpan(0, 0, 1)), customerID);
        BindText(litTodayNum, dt);
        dt = objO.GetOnlineCount(PublicFunction.EmptyDate, PublicFunction.EmptyDate, customerID);
        BindText(litTotalNum, dt);
        */

        lblToday.Text = Application["counter"].ToString();
        Online_Member online = new Online_Member();
        online.OnlineID = "95000";
        if (online.Exist())
        {
            this.lblTotal.Text = online.TotalOnline.ToString();
            this.lblTotalToday.Text = online.TotalTodayOnline.ToString();
        }
    }


    private void initLink()
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder(300);
        sb.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"").Append(FilePath("skin/99XB_cs/reset.css")).Append("\" />");
        sb.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"").Append(FilePath("skin/99XB_cs/99XB.css")).Append("\" />");
        sb.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + FilePath("kindeditor/skins/default.css") + "\" />");
        sb.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + source + "/css/classic_cs/Common.css\" />");
        //sb.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"").Append(FilePath("skin/99XB_cs/jquery-ui-1.9.2.custom.min.css")).Append("\" />");
        //sb.Append("<script type=\"text/javascript\" src=\"").Append(FilePath("Js/Common/jquery.min.js")).Append("\"></script>");
        sb.Append("<script type=\"text/javascript\" src=\"").Append(FilePath("Js/Common/jquery-1.6.2.min.js")).Append("\"></script>");
        //sb.Append("<script type=\"text/javascript\" src=\"").Append(FilePath("Js/Common/jquery-1.8.3.min.js")).Append("\"></script>");
        //sb.Append("<script type=\"text/javascript\" src=\"").Append(FilePath("Js/Common/jquery-ui-1.9.2.custom.min.js")).Append("\"></script>");
        sb.Append("<script type=\"text/javascript\" src=\"").Append(FilePath("Js/XB/Default.js")).Append("\"></script>");
        sb.Append("<script type=\"text/javascript\" src=\"").Append(FilePath("Js/Common/common.js")).Append("\"></script>");
        sb.Append("<script type=\"text/javascript\"> ");
        sb.Append("var rootpath = \"").Append(FilePath("")).Append("\";");
        //sb.Append("var memberID = \"").Append(this.Member.MemberID).Append("\";");
        //sb.Append("var customerID = \"").Append(this.Member.CustomerID).Append("\";");
        sb.Append("</script>");


        sb.Append("<script type=\"text/javascript\">");
        sb.Append("var allowsignup = ");
        sb.Append(Customer.IsSignUp);
        sb.Append(";var customerCode = \"");
        sb.Append(this.CustomerCode.ToLower());
        sb.Append("\";</script>");
        sb.AppendLine();
        sb.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + FilePath("css/classic_cs/Reset.css")+"\" />");
        sb.AppendLine();
        sb.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + FilePath("ss/classic_cs/CommonW.css")+"\" />");
        sb.AppendLine();
        sb.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + FilePath("css/classic_cs/jquery-ui.css")+"\" />");
        sb.AppendLine();
        sb.Append("<script type=\"text/javascript\" src=\"" + FilePath("js/common/jquery.min.js")+"\"></script>");
        sb.AppendLine();
        sb.Append("<script type=\"text/javascript\" src=\"" + FilePath("js/common/jquery.pngFix.js")+"\"></script>");
        sb.AppendLine();
        sb.Append("<script type=\"text/javascript\" src=\"" + FilePath("js/common/jquery.ui.min.js")+"\"></script>");
        sb.AppendLine();
        sb.Append("<script type=\"text/javascript\" src=\"" + FilePath("js/common/jquery.ui.widget.js")+"\"></script>");
        sb.AppendLine();
        sb.Append("<script type=\"text/javascript\" src=\"" + FilePath("js/common/common.js") + "\"></script>");
        sb.AppendLine();
        this.litLink.Text = sb.ToString();
    }

    protected string GetSnsURL()
    {
        return System.Configuration.ConfigurationManager.AppSettings.Get("BlogSNSUrl");
    }
}
